Collect user interactions as events in your ecommerce store.
clickAnalytics
parameter to true
when making search requests.
This includes the queryID
parameter in the search response,
which is required for linking events and search requests.
search-insights
library.
search-insights
library, initialize the client in your website.
User action | Method name |
---|---|
User clicks search result | clickedObjectIDsAfterSearch |
User adds product to shopping cart | addedToCartObjectIDsAfterSearch |
User clicks categories/filters | clickedFilters |
User views search results | viewedObjectIDs |
User action | Method name |
---|---|
User clicks product | clickedObjectIDsAfterSearch |
User adds product to shopping cart | addedToCartObjectIDsAfterSearch |
User views category page | viewedObjectIDs |
User action | Method name |
---|---|
User adds product to cart | addedToCartObjectIDsAfterSearch |
User views product | viewedObjectIDs |
User action | Method name |
---|---|
User buys product | purchasedObjectIDsAfterSearch |
objectID
is included in the search response for each search result as part of the hits
attribute.positions
array in clickedObjectIdsAfterSearch
contains a one-based index of the product hit in the search results.objectID
is included in the search response for each search result as part of the hits
attribute.
You should store the query ID with other product details when updating a user’s shopping cart.
This makes it easy to record query IDs for each item for any following purchase events.
objectData
to record per-object data, such as the price and quantity of the purchased products.
Users often purchase items that were added to the cart in response to different queries.
For example, a user might search for “shoes” and add a pair of shoes to their cart.
Then, they search for “lamp” and add a lamp to their cart. Then, they check out and complete the purchase of both items.
In this case, there would be a single purchase event.
Each item---the shoes and the lamp---will have the query ID of
the search they originated from.
authenticatedUserToken
parameter.
authenticatedUserToken
parameter in the Insights client, you also need to update
the user token you send with your search requests.